package top.lishuoboy.cloud.consumer.myrule;

import com.netflix.loadbalancer.IRule;
import com.netflix.loadbalancer.RoundRobinRule;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/* Eureka、Zookeeper、Consul、Nacos 均内置 Ribbon 做负载均衡 ，配置负责策略方式一样 */
@Configuration
public class MyRibbonRule {
    @Bean
    public IRule iRule() {
        return new RoundRobinRule();        // 轮询
//        return new RandomRule();            // 随机
//        return new ZoneAvoidanceRule();     // 默认的 rule
    }
}